<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1.类,类继承
        class Animal {
            constructor(name,age,color){
                this.name = name
                this.age = age
                this.color = color
            }
            shout(){
                return '吃'
            }
            jump(){
                return '跳'
            }
        }

        class Dog extends Animal {
            // constructor(name,age,color){
            //     super(name,age,color)
            // }
            shout(){
                console.log(this.name + super.shout() + '骨头');
            }
        }
        class Cat extends Animal {
            shout(){
                console.log(this.name + super.shout()+'鱼');
            }
        }

        const kj = new Dog('柯基',2,'黄色')
        console.log(kj);
        kj.shout()

        const lh = new Cat('狸花',3,'黑色')
        console.log(lh);
        lh.shout()


        // 2.购物车

        const goodsCar = [
            {
                id: + new Date(),
                gname:''
            }
        ]
        
    </script>
</body>
</html>